package database.utils;

/**
 * Created by alexander.makalov on 23.10.2014. */

import logger.LoggerManager;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;

import java.nio.file.Paths;

public class HibernateUtil {
    private static SessionFactory sessionFactory;

    static {
        try {
            //creates the session factory from hibernate.cfg.xml
            sessionFactory = HibernateConfig.getConfiguration().buildSessionFactory();
        } catch (Exception e) {
            LoggerManager.getLogger().Log(e.getMessage(), LoggerManager.LogLevel.ERROR);
            //e.printStackTrace();
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}
